package com.family.floor.search.controller;

import com.family.common.utils.R;
import com.family.floor.search.service.FloorSearchService;
import com.family.floor.search.vo.FloorVo;
import com.family.floor.search.vo.SearchParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
public class FloorSearchController {
    @Autowired
    private FloorSearchService floorSearchService;

    /**
     * 房源信息上架es
     * @return
     * @throws IOException
     */
    @RequestMapping("bacth")
    public R BatchUp() throws IOException {
        return floorSearchService.BatchUp();
    }
    /**
     * 房源信息检索
     */
    @RequestMapping("search")
    public R search(@RequestBody SearchParam searchParam) throws IOException {
        List<FloorVo> search = floorSearchService.search(searchParam);
        return R.ok().put("data",search);
    }
}
